<style>
    .layui-form-onswitch {
        border-color: #5FB878;
        background-color: #5FB878;
    }
</style>
<form class="layui-form seller-form" action="" method="post">
    <div class="layui-form-item">
        <div class="layui-inline">
            <input type="text" name="username" lay-verify="title" style="width:200px;"
                 class="layui-input" placeholder="Username">
        </div>
        <div class="layui-inline">
            <input type="text" name="business_token" lay-verify="title" style="width:200px;"
                class="layui-input" placeholder="Business Token">
        </div>
        <div class="layui-inline">
            <input type="text" name="user_memo" lay-verify="title" style="width:200px;"
                       class="layui-input" placeholder="User Memo">
        </div>
        <div class="layui-inline" style="">
            <select name="grade" lay-verify="" >
                <option value="">认证状态</option>
                <option value="0">普通用户</option>
                <option value="1">认证用户</option>
                <option value="2">管理员认证用户</option>
            </select>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline seller-inline-3" style="width: 150px;">
                <select name="user_fz" lay-verify="" >
                    <option value="">所有用户</option>
                    <option value="1">负值余额</option>
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <div class="layui-input-inline seller-inline-3" style="width: 150px;">
                <select name="check_ip" lay-verify="" >
                    <option value="">验证登录ip</option>
                    <option value="0">是</option>
                    <option value="1">否</option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline seller-inline-3" style="width: 150px;">
                <select name="tran_code" lay-verify="" >
                    <option value="">消费Code显示</option>
                    <option value="0">否</option>
                    <option value="1">是</option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline seller-inline-4">
                <input type="text" name="datetime" id="datetime" placeholder="start_time _ end_time" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline seller-inline-3" style="width: 150px;">
                <select name="is_fund" lay-verify="" >
                    <option value="">所有用户</option>
                    <option value="1">已充值用户</option>
                    <option value="2">未充值用户</option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline seller-inline-3" style="width: 150px;">
                <select name="grade_new" lay-verify="" >
                    <option value="">认证用户查询</option>
                    <option value="0">未认证或旧认证</option>
                    <option value="1">人脸认证</option>
                    <option value="2">iDenfy 未认证</option>
                    <option value="3">iDenfy 已认证</option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <div class="layui-input-inline seller-inline-3" style="width: 150px;">
                <select name="status_num" lay-verify="" >
                    <option value="">用户使用状态</option>
                    <option value="1">正常</option>
                    <option value="2">停用</option>
                    <option value="3">注销</option>
                </select>
            </div>
        </div>
        <div class="layui-inline" style="padding-left:20px;">
            <button class="layui-btn layui-btn-sm" lay-submit lay-filter="user-search"><i
                    class="iconfont icon-chaxun"></i>Search</button>
            <a href="{:url('userAdd')}" class="layui-btn layui-btn-sm"><i class="layui-icon">&#xe608;</i>Add</a>
            <a href="{:url('userRate')}" class="layui-btn layui-btn-sm">美元汇率更新(All)</a>
            <a href="{:url('userDecRate')}" class="layui-btn layui-btn-sm">拒付比例更新(All)</a>
        </div>
    </div>
</form>

<div class="table-body">
    <table id="userTable" lay-filter="test"></table>
</div>
<script type="text/html" id="is_check">
    <input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch"
           lay-text="否|是" lay-filter="is_check_user" {{ d.is_check == '1' ? 'checked' : '' }}>
</script>
<script type="text/html" id="is_code">
    <input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch"
           lay-text="是|否" lay-filter="is_code_user" {{ d.is_code == '1' ? 'checked' : '' }}>
</script>
<script type="text/html" id="redict" >
    <a href="{:url('cards/index')}?user_id={{d.id}}">{{d.username}}</a>
</script>
<script>
    layui.use(['form', 'table' , 'laydate'], function () {

        //时间插件
        layui.laydate.render({
            elem: '#datetime',
            range: '_',
            format: 'yyyy-MM-dd'
        });

        var tableIn = layui.table.render({
            elem: '#userTable',
            height: 'full-139',
            cellMinWidth: '80',
            totalRow: true,
            toolbar: '#toolbar', //开启头部工具栏，并为其绑定左侧模板
            defaultToolbar: ['exports'],
            url: "{:url('user/index')}?_ajax=1",
            id: 'userTable',
            cols: [[
                // {type:'checkbox'},
                { type: 'numbers'},
                { field: 'id', title: 'id', width:90},
                { field: 'status', title: 'Status', width:90 ,
                    templet: function (d) {
                        var html = '<a class="layui-btn layui-btn-xs change_status" data-id="' + d.id + '">up</a>&nbsp';
                        const status = d.status;
                        if(status == 1){
                            html+= '<span style="color: green">正常</span>';
                        }else if(status == 2){
                            html+= '<span style="color: red">停用</span>';
                        }else if(status == 3){
                            html+= '<span style="color: #1e9fff">注销</span>';
                        }
                        return html;
                    }, align: 'center'
                },
                { field: 'username', align: 'left', style:'font-weight:bold;' , title: 'User Name',templet:'#redict',width:180},
                { field: 'option', title: 'Action', templet: function (d) {
                        var html = '<a class="layui-btn layui-btn-xs editMoney" data-id="' + d.id + '">用户余额</a>';
                        html += '<a class="layui-btn layui-btn-xs editRz" data-id="' + d.id + '">用户认证</a>';
                        html += '<a class="layui-btn layui-btn-xs editAmount" data-id="' + d.id + '">开卡金额</a>';
                        html += '<a class="layui-btn layui-btn-xs editPwd" data-id="' + d.id + '">用户密码</a>';
                        html += '<a class="layui-btn layui-btn-xs" ' +
                            'href="' + "{:url('editMax')}?user_id=" + d.id + '">费率设置</a>';
                        html += '<a class="layui-btn layui-btn-xs editDesc" data-id="' + d.id + '">备注</a>';
                        html += '<a class="layui-btn layui-btn-xs editUserName" data-id="' + d.id + '">更改用户名</a>';
                        html += '<a class="layui-btn layui-btn-xs editRate" data-id="' + d.id + '">美元汇率</a>';
                        html += '<a class="layui-btn layui-btn-xs editDecRate" data-id="' + d.id + '">拒付比例</a>';
                        return html;
                    }, align: 'center'
                },
                { field: 'balance', title: '余额($)', align:"right",width:130,
                    style:'color:#FF5722;font-weight:bold', totalRow: true},
                { field: 'fund_amount', title: '已充值金额', align:"right",width:130,
                    style:'color:#FF5722;font-weight:bold', totalRow: true},
                { field: 'card_amount', title: '卡余额', align:"right",width:130,
                    style:'color:#FF5722;font-weight:bold', totalRow: true},
                { field: 'ice_amount', title: '冻结金额($)', align:"right",width:130,
                    style:'color:#FF5722;font-weight:bold', totalRow: true},
                { field: 'create_amount', title: '建卡金额($)', align:"right",width:130,
                    style:'color:#FF5722;font-weight:bold'},
                { field: 'desc', title: 'Last Login Time', align:"right",width:160,
                    templet: function (d) {
                        const utime = d.utime;
                        if(utime != undefined){
                            return layui.util.toDateString(utime * 1000, "yyyy-MM-dd HH:mm:ss");
                        }else{
                            return '';
                        }
                    }
                },
                { field: 'usa_rate', title: '美元汇率', width:100},
                { field: 'usdt_rate', title: 'USDT汇率', width:100},
                { field: 'is_check', title: '验证登录ip', width:100 ,toolbar: '#is_check'},
                { field: 'is_code', title: '消费Code显示', width:120 ,toolbar: '#is_code'},
                { field: 'user_num', align: 'center', title: 'Memo',width:110},
                { field: 'desc', title: '备注', align:"right",width:150},
                { field: 'check_time', align: 'center', title: 'Active Time' , width: 160,
                    templet: function (d) {
                        return layui.util.toDateString(d.ctime * 1000, "yyyy-MM-dd HH:mm:ss");
                    }
                },
                { field: 'grade', align: 'center', title: '用户认证' , width: 200,
                    templet: function (d) {
                        const grade=d.grade;
                        const grade_new=d.grade_new;
                        const id=d.id;
                        const name = d.name;
                        const id_card = d.id_card;
                        var html = '';
                        if(grade == 1){
                            html= '<span id="' + id + '" style="color: green" ' +
                                'onmouseover="shows(\'姓名:' + name + ' <br/>身份证:'+ id_card +'\', ' + id + ')" ' +
                                'onmouseleave="close_tips()">已认证</span>';
                        }else if(grade == 2){
                            html= '<span style="color: #1e9fff">管理员认证</span>';
                        }else{
                            html= '<span style="color: #8c8c8c">未认证</span>';
                        }
                        if(grade == 1 && grade_new == 0){
                            html += '&nbsp;&nbsp;&nbsp;<a class="layui-btn layui-btn-xs oldCheckRef" data-id="' + d.id + '">旧认证撤销</a>';
                        }
                        return html;
                    }
                },
                { field: 'grade', align: 'center', title: '新认证' , width: 160,
                    templet: function (d) {
                        const grade_new=d.grade_new;
                        const id=d.id;
                        if(grade_new == 1){
                            return '<span id="' + id + '" style="color: green">人脸认证</span>';
                        }else if(grade_new == 2){
                            return '<span id="' + id + '" style="color: #8c8c8c">iDenfy 未认证</span>';
                        }else if(grade_new == 3) {
                            return '<span id="' + id + '" style="color: red">iDenfy 已认证</span>';
                        }else{
                            return '<span style="color: #8c8c8c">未认证或旧认证</span>';
                        }
                    }
                },
                { field: 'alipay_name', title: '支付宝账号', align:"right",width:150,
                    style:'font-weight:bold'},
                { field: 'we_chat', title: '微信账号', align:"right",width:150,
                    style:'font-weight:bold'},
                { field: 'dec_rate', title: '拒付比例', width:100},
            ]],
            page: true,
            limit: 50,
            limits: [50,  500 ,1000 , 2000],
        });
        //搜索
        layui.form.on('submit(user-search)', function (data) {
            layui.table.reload('userTable', {
                where: data.field
                , page: {
                    curr: 1 //重新从第 1 页开始
                },
                method:'POST'
            });
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
        $(document).on('click', '.oldCheckRef', function () {
            var id = $(this).attr('data-id');
            layer.confirm('确定旧实名重置么,进行操作旧身份信息将删除,并无效?', {
                title:'Window' , btn: ['confirm', 'cancel'], //按钮
            }, function () {
                JsPost("{:url('user/oldCheckRef')}", {id:id}, function(res){
                    if(res.code >0){
                        layer.msg(res.msg, { time: 1500 , icon:1}, function () {
                            tableIn.reload({
                                page:{
                                    curr :1
                                }
                            });
                        });
                    }else{
                        layer.msg(res.msg , {time:1500 , icon:2});
                    }
                })
            }, function () {
                tableIn.reload({
                    page:{
                        curr :1
                    }
                });
            });
        });

        $(document).on('click', '.change_status', function () {
            var id = $(this).attr('data-id');
            JsGet("{:url('user/editStatus')}?user_id="+id, function(e){
                if(e.status == 1){
                    layer.open({
                        type: 1,
                        title: '用户使用状态',
                        area: ['600px', '400px'], //宽高
                        content: e.datas,
                        btn:['Confirm','Close'],
                        yes:function (index,layero) {
                            var thedata = $('.operationForm').serialize();
                            var status_num   = $("#status_num").val();
                            if (status_num == '' || !status_num) {
                                layer.msg("Please input in Change User Status" , {icon:2,time:1500});
                                return false;
                            }
                            JsPost('{:url("user/editStatus")}', thedata,function (re) {
                                if(re.code >0){
                                    layer.msg(re.msg , {icon:1,time:1500});
                                    layer.close(index);
                                    tableIn.reload({
                                        page:{
                                            curr :1
                                        }
                                    });
                                }else{
                                    layer.msg(re.msg, {icon:2,time:1500});
                                }
                            });
                        }
                    });
                }else{
                    layer.msg(e.msg);
                }
            });
        });
        layui.form.on('switch(is_check_user)', function(obj){
            layer.confirm('确定更新 (登录验证IP地址) 状态 ?', {
                title:'Window' , btn: ['confirm', 'cancel'], //按钮
            }, function () {
                JsPost("{:url('user/isCheck')}", {id:obj.value}, function(res){
                    if(res.code >0){
                        layer.msg(res.msg, { time: 1500 , icon:1}, function () {
                            tableIn.reload({
                                page:{
                                    curr :1
                                }
                            });
                        });
                    }else{
                        layer.msg(res.msg , {time:1500 , icon:2});
                    }
                })
            }, function () {
                tableIn.reload({
                    page:{
                        curr :1
                    }
                });
            });
        });
        layui.form.on('switch(is_code_user)', function(obj){
            layer.confirm('确定更新 (显示包含code的消费信息) 状态?', {
                title:'Window' , btn: ['confirm', 'cancel'], //按钮
            }, function () {
                JsPost("{:url('user/isCode')}", {id:obj.value}, function(res){
                    if(res.code >0){
                        layer.msg(res.msg, { time: 1500 , icon:1}, function () {
                            tableIn.reload({
                                page:{
                                    curr :1
                                }
                            });
                        });
                    }else{
                        layer.msg(res.msg , {time:1500 , icon:2});
                    }
                })
            }, function () {
                tableIn.reload({
                    page:{
                        curr :1
                    }
                });
            });
        });
        layui.form.on('switch(change_data_show)', function(obj){
            layer.confirm('Are you sure?', {
                title:'Window' , btn: ['confirm', 'cancel'], //按钮
            }, function () {
                JsPost("{:url('user/editDataShow')}", {id:obj.value}, function(res){
                    if(res.code >0){
                        layer.msg(res.msg, { time: 1500 , icon:1}, function () {
                            tableIn.reload({
                                page:{
                                    curr :1
                                }
                            });
                        });
                    }else{
                        layer.msg(res.msg , {time:1500 , icon:2});
                    }
                })
            }, function () {
                tableIn.reload({
                    page:{
                        curr :1
                    }
                });
            });
        });
        $(document).on('click', '.editDesc', function () {
            var id = $(this).attr('data-id');
            JsGet("{:url('user/editDesc')}?user_id="+id, function(e){
                if(e.status == 1){
                    layer.open({
                        type: 1,
                        title: 'UserName Remarks',
                        area: ['550px', '300px'], //宽高
                        content: e.datas,
                        btn:['Confirm','Close'],
                        yes:function (index,layero) {
                            var thedata = $('.operationForm').serialize();
                            JsPost('{:url("user/editDesc")}', thedata,function (re) {
                                if(re.code >0){
                                    layer.msg(re.msg , {icon:1,time:1500});
                                    layer.close(index);
                                    tableIn.reload({
                                        page:{
                                            curr :1
                                        }
                                    });
                                }else{
                                    layer.msg(re.msg, {icon:2,time:1500});
                                }
                            });
                        }
                    });
                }else{
                    layer.msg(e.msg);
                }
            });
        });
        //余额编辑
        $(document).on('click', '.editMoney', function () {
            var id = $(this).attr('data-id');
            JsGet("{:url('user/editMoney')}?user_id="+id, function(e){
                if(e.status == 1){
                    layer.open({
                        type: 1,
                        title: '用户余额更新',
                        area: ['600px', '550px'], //宽高
                        content: e.datas,
                        btn:['Confirm','Close'],
                        yes:function (index,layero) {
                            var thedata = $('.operationForm').serialize();
                            var money   = $("#money").val();
                            if (money == '' || !money) {
                                layer.msg("Please input in Change Money" , {icon:2,time:1500});
                                return false;
                            }
                            JsPost('{:url("user/editMoney")}', thedata,function (re) {
                                if(re.code >0){
                                    layer.msg(re.msg , {icon:1,time:1500});
                                    layer.close(index);
                                    tableIn.reload({
                                        page:{
                                            curr :1
                                        }
                                    });
                                }else{
                                    layer.msg(re.msg, {icon:2,time:1500});
                                }
                            });
                        }
                    });
                }else{
                    layer.msg(e.msg);
                }
            });
        });
        $(document).on('click', '.editRate', function () {
            var id = $(this).attr('data-id');
            JsGet("{:url('user/editRate')}?user_id="+id, function(e){
                if(e.status == 1){
                    layer.open({
                        type: 1,
                        title: '美元汇率更新',
                        area: ['550px', '300px'], //宽高
                        content: e.datas,
                        btn:['Confirm','Close'],
                        yes:function (index,layero) {
                            var thedata = $('.operationForm').serialize();
                            var money   = $("#money").val();
                            if (money == '' || !money) {
                                layer.msg("Please input in Change Money" , {icon:2,time:1500});
                                return false;
                            }
                            JsPost('{:url("user/editRate")}', thedata,function (re) {
                                if(re.code >0){
                                    layer.msg(re.msg , {icon:1,time:1500});
                                    layer.close(index);
                                    tableIn.reload({
                                        page:{
                                            curr :1
                                        }
                                    });
                                }else{
                                    layer.msg(re.msg, {icon:2,time:1500});
                                }
                            });
                        }
                    });
                }else{
                    layer.msg(e.msg);
                }
            });
        });
        $(document).on('click', '.editDecRate', function () {
            var id = $(this).attr('data-id');
            JsGet("{:url('user/editDecRate')}?user_id="+id, function(e){
                if(e.status == 1){
                    layer.open({
                        type: 1,
                        title: '拒付比例更新',
                        area: ['550px', '400px'], //宽高
                        content: e.datas,
                        btn:['Confirm','Close'],
                        yes:function (index,layero) {
                            var thedata = $('.operationForm').serialize();
                            var money   = $("#money").val();
                            if (money == '' || !money) {
                                layer.msg("Please input in Change Money" , {icon:2,time:1500});
                                return false;
                            }
                            JsPost('{:url("user/editDecRate")}', thedata,function (re) {
                                if(re.code >0){
                                    layer.msg(re.msg , {icon:1,time:1500});
                                    layer.close(index);
                                    tableIn.reload({
                                        page:{
                                            curr :1
                                        }
                                    });
                                }else{
                                    layer.msg(re.msg, {icon:2,time:1500});
                                }
                            });
                        }
                    });
                }else{
                    layer.msg(e.msg);
                }
            });
        });
        //余额编辑
        $(document).on('click', '.editPwd', function () {
            var id = $(this).attr('data-id');
            JsGet("{:url('user/editPwd')}?user_id="+id, function(e){
                if(e.status == 1){
                    layer.open({
                        type: 1,
                        title: 'Edit User PassWord',
                        area: ['550px', '300px'], //宽高
                        content: e.datas,
                        btn:['Confirm','Close'],
                        yes:function (index,layero) {
                            var thedata = $('.operationForm').serialize();
                            var pwd   = $("#pwd").val();
                            if (pwd == '' || !pwd) {
                                layer.msg("Please fill in a new password." , {icon:2,time:1500});
                                return false;
                            }
                            JsPost('{:url("user/editPwd")}', thedata,function (re) {
                                if(re.code >0){
                                    layer.msg(re.msg , {icon:1,time:1500});
                                    layer.close(index);
                                    tableIn.reload({
                                        page:{
                                            curr :1
                                        }
                                    });
                                }else{
                                    layer.msg(re.msg, {icon:2,time:1500});
                                }
                            });
                        }
                    });
                }else{
                    layer.msg(e.msg);
                }
            });
        });

        //余额编辑
        $(document).on('click', '.setKey', function () {
            var id = $(this).attr('data-id');
            layer.confirm('Are you Set Secret Key?', {
                title:'Window' , btn: ['confirm', 'cancel'], //按钮
            }, function () {
                JsPost("{:url('user/setKey')}", {id:id}, function(res){
                    if(res.code >0){
                        layer.msg(res.msg, { time: 1500 , icon:1}, function () {
                            tableIn.reload({
                                page:{
                                    curr :1
                                }
                            });
                        });
                    }else{
                        layer.msg(res.msg , {time:1500 , icon:2});
                    }
                })
            }, function () {
                tableIn.reload({
                    page:{
                        curr :1
                    }
                });
            });
        });

        $(document).on('click', '.editAmount', function () {
            var id = $(this).attr('data-id');
            JsGet("{:url('user/editAmount')}?user_id="+id, function(e){
                if(e.status == 1){
                    layer.open({
                        type: 1,
                        title: 'Edit Create Card Amount',
                        area: ['550px', '400px'], //宽高
                        content: e.datas,
                        btn:['Confirm','Close'],
                        yes:function (index,layero) {
                            var thedata = $('.operationForm').serialize();
                            var money   = $("#money").val();
                            if (money == '' || !money) {
                                layer.msg("Please input in Change Money" , {icon:2,time:1500});
                                return false;
                            }
                            JsPost('{:url("user/editAmount")}', thedata,function (re) {
                                if(re.code >0){
                                    layer.msg(re.msg , {icon:1,time:1500});
                                    layer.close(index);
                                    tableIn.reload({
                                        page:{
                                            curr :1
                                        }
                                    });
                                }else{
                                    layer.msg(re.msg, {icon:2,time:1500});
                                }
                            });
                        }
                    });
                }else{
                    layer.msg(e.msg);
                }
            });
        });

        $(document).on('click', '.editRz', function () {
            var id = $(this).attr('data-id');
            JsGet("{:url('user/editRz')}?user_id="+id, function(e){
                if(e.status == 1){
                    layer.open({
                        type: 1,
                        title: '用户认证',
                        area: ['550px', '500px'], //宽高
                        content: e.datas,
                        btn:['Confirm','Close'],
                        yes:function (index,layero) {
                            var thedata = $('.operationForm').serialize();
                            var rz_status   = $("#rz_status").val();
                            JsPost('{:url("user/editRz")}', thedata,function (re) {
                                if(re.code >0){
                                    layer.msg(re.msg , {icon:1,time:1500});
                                    layer.close(index);
                                    tableIn.reload({
                                        page:{
                                            curr :1
                                        }
                                    });
                                }else{
                                    layer.msg(re.msg, {icon:2,time:1500});
                                }
                            });
                        }
                    });
                }else{
                    layer.msg(e.msg);
                }
            });
        });

        $(document).on('click', '.editOpen', function () {
            var id = $(this).attr('data-id');
            JsGet("{:url('user/editOpen')}?user_id="+id, function(e){
                if(e.status == 1){
                    layer.open({
                        type: 1,
                        title: 'Edit Open Card Amount',
                        area: ['550px', '400px'], //宽高
                        content: e.datas,
                        btn:['Confirm','Close'],
                        yes:function (index,layero) {
                            var thedata = $('.operationForm').serialize();
                            var open_money   = $("#open_money").val();
                            if (open_money == '' || !open_money) {
                                layer.msg("Please input in Change Money" , {icon:2,time:1500});
                                return false;
                            }
                            JsPost('{:url("user/editOpen")}', thedata,function (re) {
                                if(re.code >0){
                                    layer.msg(re.msg , {icon:1,time:1500});
                                    layer.close(index);
                                    tableIn.reload({
                                        page:{
                                            curr :1
                                        }
                                    });
                                }else{
                                    layer.msg(re.msg, {icon:2,time:1500});
                                }
                            });
                        }
                    });
                }else{
                    layer.msg(e.msg);
                }
            });
        });

        $(document).on('click', '.editMax', function () {
            var id = $(this).attr('data-id');
            JsGet("{:url('user/editMax')}?user_id="+id, function(e){
                if(e.status == 1){
                    layer.open({
                        type: 1,
                        title: '自定义卡设置',
                        area: ['700px', '400px'], //宽高
                        content: e.datas,
                        btn:['Confirm','Close'],
                        yes:function (index,layero) {
                            var thedata = $('.operationForm').serialize();
                            var max_card   = $("#max_card").val();
                            if (max_card == '' || !max_card) {
                                layer.msg("请填写最大开卡数." , {icon:2,time:1500});
                                return false;
                            }
                            var rate   = $("#rate").val();
                            if (rate == '' || !rate) {
                                layer.msg("请填写开卡费率." , {icon:2,time:1500});
                                return false;
                            }
                            var open_556735   = $("#open_556735").val();
                            if (open_556735 == '' || !open_556735) {
                                layer.msg("请填写开卡费(556735)." , {icon:2,time:1500});
                                return false;
                            }
                            var open_556305   = $("#open_556305").val();
                            if (open_556305 == '' || !open_556305) {
                                layer.msg("请填写开卡费(556305)." , {icon:2,time:1500});
                                return false;
                            }
                            var open_556766   = $("#open_556766").val();
                            if (open_556766 == '' || !open_556766) {
                                layer.msg("请填写开卡费(556766)." , {icon:2,time:1500});
                                return false;
                            }
                            var open_558068   = $("#open_558068").val();
                            if (open_558068 == '' || !open_558068) {
                                layer.msg("请填写开卡费(558068)." , {icon:2,time:1500});
                                return false;
                            }
                            var open_531847   = $("#open_531847").val();
                            if (open_531847 == '' || !open_531847) {
                                layer.msg("请填写开卡费(531847)." , {icon:2,time:1500});
                                return false;
                            }
                            JsPost('{:url("user/editMax")}', thedata,function (re) {
                                if(re.code >0){
                                    layer.msg(re.msg , {icon:1,time:1500});
                                    layer.close(index);
                                    tableIn.reload({
                                        page:{
                                            curr :1
                                        }
                                    });
                                }else{
                                    layer.msg(re.msg, {icon:2,time:1500});
                                }
                            });
                        }
                    });
                }else{
                    layer.msg(e.msg);
                }
            });
        });
        //余额编辑
        $(document).on('click', '.editFee', function () {
            var id = $(this).attr('data-id');
            JsGet("{:url('user/editFee')}?user_id="+id, function(e){
                if(e.status == 1){
                    layer.open({
                        type: 1,
                        title: 'Edit Monthly Fee',
                        area: ['550px', '300px'], //宽高
                        content: e.datas,
                        btn:['Confirm','Close'],
                        yes:function (index,layero) {
                            var thedata = $('.operationForm').serialize();
                            var money   = $("#money").val();
                            if (money == '' || !money) {
                                layer.msg("Please input in Change Money" , {icon:2,time:1500});
                                return false;
                            }
                            JsPost('{:url("user/editFee")}', thedata,function (re) {
                                if(re.code >0){
                                    layer.msg(re.msg , {icon:1,time:1500});
                                    layer.close(index);
                                    tableIn.reload({
                                        page:{
                                            curr :1
                                        }
                                    });
                                }else{
                                    layer.msg(re.msg, {icon:2,time:1500});
                                }
                            });
                        }
                    });
                }else{
                    layer.msg(e.msg);
                }
            });
        });
        //余额编辑
        $(document).on('click', '.editUserName', function () {
            var id = $(this).attr('data-id');
            JsGet("{:url('user/editUserName')}?user_id="+id, function(e){
                if(e.status == 1){
                    layer.open({
                        type: 1,
                        title: 'Edit UserName',
                        area: ['550px', '300px'], //宽高
                        content: e.datas,
                        btn:['Confirm','Close'],
                        yes:function (index,layero) {
                            var thedata = $('.operationForm').serialize();
                            var new_name   = $("#new_name").val();
                            if (new_name == '' || !new_name) {
                                layer.msg("Please input in UserName" , {icon:2,time:1500});
                                return false;
                            }
                            JsPost('{:url("user/editUserName")}', thedata,function (re) {
                                if(re.code >0){
                                    layer.msg(re.msg , {icon:1,time:1500});
                                    layer.close(index);
                                    tableIn.reload({
                                        page:{
                                            curr :1
                                        }
                                    });
                                }else{
                                    layer.msg(re.msg, {icon:2,time:1500});
                                }
                            });
                        }
                    });
                }else{
                    layer.msg(e.msg);
                }
            });
        });
        //余额编辑
        $(document).on('click', '.editMonthFee', function () {
            var id = $(this).attr('data-id');
            JsGet("{:url('user/editMonthFee')}?user_id="+id, function(e){
                if(e.status == 1){
                    layer.open({
                        type: 1,
                        title: 'Monthly Fee',
                        area: ['550px', '480px'], //宽高
                        content: e.datas,
                        btn:['Confirm','Close'],
                        yes:function (index,layero) {
                            var thedata = $('.operationForm').serialize();
                            var money   = $("#money").val();
                            if (money == '' || !money) {
                                layer.msg("Please input in Change Money" , {icon:2,time:1500});
                                return false;
                            }
                            JsPost('{:url("user/editMonthFee")}', thedata,function (re) {
                                if(re.code >0){
                                    layer.msg(re.msg , {icon:1,time:1500});
                                    layer.close(index);
                                    tableIn.reload({
                                        page:{
                                            curr :1
                                        }
                                    });
                                }else{
                                    layer.msg(re.msg, {icon:2,time:1500});
                                }
                            });
                        }
                    });
                }else{
                    layer.msg(e.msg);
                }
            });
        });
    });

    function shows(msg , id){
        layer.tips('' + msg, '#' + id ,{tips:[1,'blace'] , area:[100,40]});
    }
    function close_tips(){
        layer.closeAll();
    }
</script>